package com.bl.student.dao.redis;

import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

/**
 * Created by yujingyi on 2017/9/20.
 */
@Component
@Log4j2
public class IdDao extends AbstractDao {

    private final String TRADE_NO_KEY_PREFIX = "TRADE_NO_";

    public void getIdSerialNum(String key, String val) {
        set(genKey(TRADE_NO_KEY_PREFIX, key), val, 1000);
    }

    public Long incrAndGetIdSerialNum(String key) {
        return incr(genKey(TRADE_NO_KEY_PREFIX, key), 1000);
    }
}
